﻿using System;
using System.ComponentModel.DataAnnotations;

namespace SilverlightCalculator
{
    public class ModelValidation
    {
        public static ValidationResult ValidateNumber(string value, ValidationContext validationContext)
        {
            try
            {
                int.Parse(value);
                return ValidationResult.Success;
            }
            catch (Exception)
            {
                return new ValidationResult("That isn't a number");
            }            
        }
    }
}